﻿using System.Collections;
using UnityEngine;

public class PlayerKiller : MonoBehaviour {

    public void OnTriggerEnter2D(Collider2D collision)
    {
        if(collision.tag == "Player")
        {
            collision.GetComponent<Animator>().SetBool("hurt", true);
            collision.GetComponent<Player>().CurrentSate = PlayerState.Death;
            StartCoroutine(waitForDeath());
        }
    }

    public IEnumerator waitForDeath()
    {
        yield return new WaitForSeconds(0.5f);
        GameController.Instance.GameOver();
    }
}
